package com.zengqingfa.springboot.rest;

import com.zengqingfa.springboot.entity.Lesson;
import com.zengqingfa.springboot.entity.Student;
import com.zengqingfa.springboot.mapper.second.LessonMapper;
import com.zengqingfa.springboot.mapper.first.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @fileName: MultiDbRest
 * @author: zengqf3
 * @date: 2020-8-4 17:31
 * @description:
 */
@RestController
@RequestMapping("/multidb")
public class MultiDbRest {

    @Autowired
    private LessonMapper lessonMapper;
    @Autowired
    private StudentMapper studentMapper;


    @GetMapping("/getLesson")
    public List<Lesson> getLessons() {
        return lessonMapper.findById(1);
    }

    @GetMapping("/getStudents")
    public List<Student> getStudents() {
        return studentMapper.queryStudents();
    }
}
